package com.situ.blog.controller;

import com.situ.blog.pojo.Blog;
import com.situ.blog.service.IBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    private IBlogService blogService;

    @RequestMapping("/toBlogDetail")
    public String toBlogDetail(Integer id, Model model) {
        Blog blog = blogService.selectById(id);
        model.addAttribute("blog", blog);
        return "blog_detail";
    }
}
